package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.domian.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UserMapper {
    @Select("select * from user where name=#{name} and password=#{password} ")
    User login(User user);

    @Select("select * from user")
    Page<User> selectAllUser();

    @Insert("insert into user(name,password)\n" +
            "        values (#{name},#{password}) ")
    void addUser(User user);

    @Update("update user set password = #{password}\n" +
            " where name=#{name} ")
    void updateUser(User user);

    @Delete("delete from user where id=#{id} ")
    void deleteUser(User user);
}
